/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.cinfo.siga.datos;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author alumno
 */
@Entity
@Table(name = "DOCU_IDEN")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "DocumentoIdentidad.findAll", query = "SELECT d FROM DocumentoIdentidad d"),
    @NamedQuery(name = "DocumentoIdentidad.findByDocCod", query = "SELECT d FROM DocumentoIdentidad d WHERE d.docCod = :docCod")})
public class DocumentoIdentidad implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "DOC_COD")
    private String docCod;
    @OneToMany(mappedBy = "docCod", fetch = FetchType.LAZY)
    private List<Alumno> alumnoList;

    public DocumentoIdentidad() {
    }

    public DocumentoIdentidad(String docCod) {
        this.docCod = docCod;
    }

    public String getDocCod() {
        return docCod;
    }

    public void setDocCod(String docCod) {
        this.docCod = docCod;
    }

    @XmlTransient
    public List<Alumno> getAlumnoList() {
        return alumnoList;
    }

    public void setAlumnoList(List<Alumno> alumnoList) {
        this.alumnoList = alumnoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (docCod != null ? docCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DocumentoIdentidad)) {
            return false;
        }
        DocumentoIdentidad other = (DocumentoIdentidad) object;
        if ((this.docCod == null && other.docCod != null) || (this.docCod != null && !this.docCod.equals(other.docCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.cinfo.siga.datos.DocumentoIdentidad[ docCod=" + docCod + " ]";
    }
    
}
